<?
	include("includes/config.php");
	include("includes/login.php");
	include("includes/functions.php");
	if(@$_POST['modifica']){
		$nume = $_POST['nume'];
		$cf = $_POST['cf'];
		$cnp = $_POST['cnp'];
		$nrord = $_POST['nrord'];
		$ci = $_POST['ci'];
		$localitate = $_POST['localitate'];
		$telefon = $_POST['telefon'];
		$email = $_POST['email'];
		$web = $_POST['web'];
		$delegati = $_POST['delegati'];
		$sefparc = $_POST['sefparcauto'];
		$idclient = $_POST['idclient'];
		$adresa = $_POST['adresa'];
		mysql_query("update parteneri set nume='$nume',CF='$cf',cnp='$cnp',nr_ord_rc='$nrord',CI='$ci',localitate='$localitate',telefon='$telefon',email='$email',web='$web',delegati='$delegati',sef_parc_auto='$sefparc',adresa='$adresa' where id_client='$idclient'");
		$link = $_SERVER['REQUEST_URI'];
		header("location:".$link."&msg=true");
	}
?>
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="css/style.css" />
	</head>
	<body>
		<div id="header"><h1> <? echo detaliFirma('nume_firma'); ?></h1></div>
		<div id="warper">
			<?
				$resMeniu = mysql_query("select * from meniu");
				$id_masina = $_GET['masina'];
				$id_partener = $_GET['id_partener'];
			?>
			<div id="menu">
				<ul>
					<? while($rowMen = mysql_fetch_array($resMeniu)): ?>
					<li><a href="<?echo $rowMen['link'];?>"><? echo $rowMen['numeLink']; ?></a></li>
					<? endwhile; ?>
				</ul>
			</div>
			<div id="content">
				<div id="contentWrap">
					<?
						$res = mysql_query("select * from parteneri where id_client = '$id_partener'");
						while($row = mysql_fetch_array($res)):
					?>
						<p>
						<a href="/comandanoua.php?id_client=<? echo $_GET['id_partener'];?>&id_masina=<? echo $_GET['masina'];?>" class="buton">Comanda / Deviz Nou </a>&nbsp; 	<a href="/partener_nou_adauga_masina.php?id_client=<? echo $row['id_client'];?>&nume_partener=<? echo $row['nume'];?>" class="buton" > Adauga Masina Partener Existent</a>
					
							
							</p>
						<br/>
						<form action="" method="post">
							<p>
								<label>Nume</label>
								<input class="text" type="text" name="nume" value="<? echo $row['nume'];?>">
							</p>
							<? if($row['tip_persoana'] == "fizica" ): ?>
							<p>
								<label>C.N.P</label>
								<input class="text" type="text" name="cnp" value="<? echo $row['cnp'];?>">
							</p>
							<p>
								<label>C.I</label>
								<input class="text" type="text" name="ci" value="<? echo $row['CI'];?>">
							</p>
							<? else: ?>
							<p>
								<label>CF</label>
								<input class="text" type="text" name="cf" value="<? echo $row['CF'];?>">
							</p>
							<p>
								<label>Nr.Ord.Rc</label>
								<input class="text" type="text" name="nrord" value="<? echo $row['nr_ord_rc'];?>">
							</p>
							<p>
								<label>Delegati</label>
								<input class="text" type="text" name="delegati" value="<? echo $row['delegati'];?>">
							</p>
							<p>
								<label>Sef parc auto</label>
								<input class="text" type="text" name="sefparcauto" value="<? echo $row['sef_parc_auto'];?>">
							</p>
						
							<? endif; ?>
							
							<p>
								<label>Localitate</label>
								<input class="text" type="text" name="localitate" value="<? echo $row['localitate'];?>">
							</p>
							<p>
								<label>Telefon</label>
								<input class="text" type="text" name="telefon" value="<? echo $row['telefon'];?>">
							</p>
							<p>
								<label>Email</label>
								<input class="text" type="text" name="email" value="<? echo $row['email'];?>">
							</p>
							<p>
								<label>Web</label>
								<input class="text" type="text" name="web" value="<? echo $row['web'];?>">
							</p>
							<p>
								<label>Adresa</label>
								<input class="text" type="text" name="adresa" value="<? echo $row['adresa'];?>">
							</p>
							<p>
								<input class="buton" type="submit" value="Modifica" name="modifica">
							</p>
								<input type="hidden" value="<? echo $row['id_client']; ?>" name="idclient" >
						</from>
						<p style="color:#00a652;font-size:16px;font-weight:bold;">
							<?
								if(@$_GET['msg']){
									echo "Modificat cu succes!";
								}
							?>
						</p>
					<?endwhile; ?>
					
					
					<br/>
					<h3>Modificari effectuate masinii:</h3>
					
					<? 
						$res = mysql_query("select descriere_manopera,data_lucrare_manopera from parteneri_masini_manopera where id_masina = '$id_masina' order by data_lucrare_manopera desc");
						while($row = mysql_fetch_array($res)):
					?>
						<p class="block">Operatiune efectuata: 
							<b><? echo $row['descriere_manopera']; ?></b>
							<br/>Data efectuarii manoperei: <b><? echo $row['data_lucrare_manopera']; ?></b>
						</p>
						
					<? endwhile; ?>
					
				</div>
			</div>
		</div>
	</body>
</html>